package com.ddwl.goods.controller;

import com.ddwl.common.annotation.Auth;
import com.ddwl.common.constant.BaseEnum;
import com.ddwl.common.controller.BaseController;
import com.ddwl.goods.service.EssayCheckService;
import com.ddwl.schema.bo.base.PageBo;
import com.ddwl.schema.bo.goods.AcademyCheckPageBo;
import com.ddwl.schema.bo.goods.EssayCheckBo;
import com.ddwl.schema.vo.base.PageVo;
import com.ddwl.schema.vo.base.RestVo;
import com.ddwl.schema.vo.goods.AcademyVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @Author hemiaojun
 * @Date 2020/11/20 10:47
 */
@RestController
@RequestMapping("/essayCheck")
@Api(tags = "文章审核")
public class EssayCheckController extends BaseController {

    @Resource
    private EssayCheckService essayCheckService;


    @PostMapping("/check")
    @Auth(product = {BaseEnum.ProductEnum.CONSOLE})
    @ApiOperation("文章审核")
    public RestVo checkEssay(@RequestBody EssayCheckBo bo){
        essayCheckService.save(bo, getUserId(),getUserNameNew());
        return RestVo.ok();
    }

    @PostMapping("/pageNeedCheckAcademy")
    @Auth(product = {BaseEnum.ProductEnum.CONSOLE})
    @ApiOperation("待审核文章列表")
    public RestVo<PageVo<AcademyVo>> pageNeedCheckAcademy(@RequestBody PageBo<AcademyCheckPageBo> bo){
        return RestVo.ok(essayCheckService.pageNeedCheckAcademy(bo));
    }


}
